<template>
  <div>
    <el-table :data="list">
      <el-table-column type="index"> </el-table-column>
      <el-table-column prop="authName" label="权限名称"> </el-table-column>
      <el-table-column prop="path" label="路径"> </el-table-column>
      <el-table-column label="权限登记">
        <template slot-scope="scope">
          <el-tag v-if="scope.row.level === '0'">一级</el-tag>
         <el-tag type="success" v-if="scope.row.level === '1'"
            >二级</el-tag
          >
          <el-tag type="waring" v-if="scope.row.level === '2'"
            >三级</el-tag
          >
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import { getRightApi } from '../../../api/rights';

export default {
  data() {
    return {
      list: [],
    };
  },
  created() {
    this.getRightList();
  },
  methods: {
    async getRightList() {
      const res = await getRightApi();
      if (res.meta.status !== 200) return this.$message.error(res.meta.msg);
      this.list = res.data;
    },
  },
};
</script>

<style>
</style>
